/*
 * @Author: master
 * @Date: 2022-04-04 14:24:50
 * @LastEditTime: 2022-04-06 14:37:26
 * @Description: 路由守卫,路由元信息,全局的导航钩子
 */
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css'; // progress style
import { setRouteEmitter } from './route-listener.js'; // 路由监听
const createRouteGuard = router => {
  router.beforeEach((to, from, next) => {
    NProgress.start();
    next();
    NProgress.done();
    // 添加路由监听
    setRouteEmitter(to);
  });
};
export default createRouteGuard;
